<?php

/**
 * Albireo Kernel
 *
 * @copyright  Copyright (c) 2010 Albireo Solutions
 * @package    Kernel
 */

namespace KernelModule\ApplicationsModule;

use \Nette\Object;
use \Nette\Collections\ArrayList;
use \dibi;
use \DibiDataSource;

use Albireo\Application\ApplicationManager;

/**
 * Acl Management
 *
 * @author Albireo Solutions
 */
class AppManagement extends Object {

    private $model;

    public function __construct($user) {
        $this->model = new ApplicationManager($user);
    }

    public function getDataSource() {
        return new DibiDataSource("applications", dibi::getConnection());
    }

    public function addApplication($app) {
        return $this->model->addApplication($app);
    }
    
    public function updateApplication($app) {
        return $this->model->updateApplication($app);
    }
    
    public function getAppByName($name) {
        return $this->model->getApplicationByName($name);
    }
    
    public function deleteApp($app) {
        return $this->model->removeApplication($app);
    }
}